1. Field of the Invention
The present invention relates to an analog-to-digital converter, and more specifically, to an analog-to-digital converter that calculates a digital output voltage based on a time required to charge a capacitor.
2. Description of the Prior Art
Conventionally, analog-to-digital converters are used to convert an analog input voltage into a digital output voltage of a fixed resolution, which determines the precision of the analog-to-digital converter. Each analog-to-digital converter is usually rated to handle a specific range of analog input voltages to avoid saturating the analog-to-digital converter.
Please refer to FIG. 1. FIG. 1 is a schematic diagram of an analog-to-digital converter 10 according to the prior art. The analog-to-digital converter 10 contains input pins 16 and 18 for inputting an analog voltage to the analog-to-digital converter 10. Input pins 12, 14, and 20 are respectively used for providing a voltage input, a ground reference, and a voltage reference to the analog-to-digital converter 10. The analog-to-digital converter 10 calculates an analog voltage difference across input pins 16 and 18, converts the analog voltage into a digital output voltage, and outputs the digital output voltage on a plurality of output pins 25. The number of output pins 25 depends on the resolution of the analog-to-digital converter 10, and the analog-to-digital converter 10 shown in FIG. 1 has n output pins 25 corresponding to an n-bit resolution. For example, an eight-bit resolution would require eight output pins 25 to output the digital output voltage.
Unfortunately, the analog-to-digital converter 10 contains a fixed resolution which is determined according to the complexity of the circuitry inside the analog-to-digital converter 10. Changing the resolution of the analog-to-digital converter 10 requires designing the analog-to-digital converter 10 all over from scratch, and very little of the original design can be salvaged.
It is therefore a primary objective of the claimed invention to provide an analog-to-digital converter utilizing a timer for conveniently adjusting the resolution of the analog-to-digital converter in order to solve the above-mentioned problems.
According to the claimed invention, an analog-to-digital converter includes at least one input pin for receiving an analog input voltage, a capacitor for storing charge and producing a voltage across the capacitor, and a current source for flowing current through the capacitor for charging the capacitor. The analog-to-digital converter also contains a first switch electrically connected between the current source and the capacitor for controlling flow of current from the current source to the capacitor, a comparator for outputting a first comparison value when the analog input voltage is approximately equal to the voltage across the capacitor, and a timer for calculating a charging period of time needed for the voltage across the capacitor to become equal to the analog input voltage. Before the capacitor is charged, it is discharged to remove all remaining charge. Then, the timer starts calculating the charging period of time when the first switch electrically connects the current source to the capacitor for charging the capacitor and stops calculating the charging period of time when the comparator outputs the first comparison value. A controller is used for controlling operation of the first switch, for starting the timer when the first switch electrically connects the current source to the capacitor for charging the capacitor, for stopping the timer when the comparator outputs the first comparison value, and for converting the charging period of time calculated by the timer into a digital output voltage.
It is an advantage of the claimed invention that resolution of the analog-to-digital converter can easily be adjusted by changing the clock rate of the timer. The analog-to-digital converter can be used in a variety of applications that require a range of different resolutions, or for any application that requires high resolution and for which a fast conversion time is not critical.
These and other objectives of the claimed invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment, which is illustrated in the various figures and drawings.